package com.bjtech.web.action.management;

import java.util.List;

import com.bjtech.dao.BaseRoomInfoDao;
import com.bjtech.dao.LoginUserInfoDao;
import com.bjtech.domain.LoginUserInfo;
import com.bjtech.domain.query.LoginUserInfoQuerySpec;
import com.bjtech.web.action.LyheatBaseAction;

public class LoginUserInfoAction extends LyheatBaseAction {

	private static final long serialVersionUID = 1L;
	private LoginUserInfoDao loginUserInfoDao;
	private LoginUserInfoQuerySpec selectBean;

	private BaseRoomInfoDao baseRoomInfoDao;
	private List roomList;

	public void prepare() throws Exception {

	}

	public LoginUserInfoAction() throws Exception {
		model = new LoginUserInfo();
		selectBean = new LoginUserInfoQuerySpec();
	}

	public void setLoginUserInfoDao(LoginUserInfoDao loginUserInfoDao) {
		this.loginUserInfoDao = loginUserInfoDao;
	}

	public String execute() {
		return "success";
	}

	public String list() {
		selectBean.queryParamString();
		list = this.loginUserInfoDao.selectEntityPaginatedList(new LoginUserInfo(), selectBean);
		return "list";
	}

	public String add() {
		return "edit";
	}

	public String save() {
		LoginUserInfo entity = (LoginUserInfo) model;
		if (entity.getId() == null) {
			entity.setPass_word("123456");//默认密码为123456
			loginUserInfoDao.insertEntity(entity);
		} else {
			loginUserInfoDao.updateEntity(entity);
		}
		return "success";
	}

	public String edit() {
		model = this.loginUserInfoDao.selectEntity(new LoginUserInfo(), id);
		return "edit";
	}

	public String view() {
		model = this.loginUserInfoDao.selectEntity(new LoginUserInfo(), id);
		return "view";
	}

	public String delete() {
		model = this.loginUserInfoDao.deleteEntity(new LoginUserInfo(), id);
		return "success";
	}

	public LoginUserInfoQuerySpec getSelectBean() {
		return selectBean;
	}

	public void setSelectBean(LoginUserInfoQuerySpec selectBean) {
		this.selectBean = selectBean;
	}

	public BaseRoomInfoDao getBaseRoomInfoDao() {
		return baseRoomInfoDao;
	}

	public void setBaseRoomInfoDao(BaseRoomInfoDao baseRoomInfoDao) {
		this.baseRoomInfoDao = baseRoomInfoDao;
	}

	public LoginUserInfoDao getLoginUserInfoDao() {
		return loginUserInfoDao;
	}
}
